<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>Grima Portal</title>
	<link rel="stylesheet" type="text/css" href="css/themes/bootstrap/easyui.css">
	<link rel="stylesheet" type="text/css" href="css/icon.css">
	<link rel="stylesheet" type="text/css" href="css/portal.css">
	<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
	
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/jquery.easyui.min.js"></script>
</head>
<body class="easyui-layout">
	
    <div id="header" data-options="region:'north',border:false"></div>
    <div id="menu" data-options="region:'west',split:true,title:' '" style="width:250px;"></div>
    <div data-options="region:'east',split:true,collapsed:true,title:' '" style="width:250px;padding:10px;"></div>
    <div id="footer" data-options="region:'south',border:false"></div>
    <div data-options="region:'center',title:'Minhas Tarefas'">
	<table id="dg" class="easyui-datagrid" title=""
			data-options="rownumbers:true,singleSelect:true,url:'tasks.json',method:'get',toolbar:'#tb',pagination:true, fitColumns:true,onClickRow: onClickRow">
		<thead>
			<tr>
				<th data-options="field:'id',width:50">ID</th>
				<th data-options="field:'process',width:220">Processo</th>
				<th data-options="field:'name',width:220">Nome</th>
				<th data-options="field:'description',width:220">Descrição</th>
				<th data-options="field:'priority',width:80,align:'left'">Prioridade</th>
				<th data-options="field:'owner',width:220,align:'left'">Solicitante</th>
				<th data-options="field:'createTime',width:100">Data Início</th>
				<th data-options="field:'dueDate',width:100,align:'center'">Prazo</th>
			</tr>
		</thead>
	</table>
	<div id="tb" style="padding:5px;height:auto">
		<div style="margin-bottom:5px">
			<a href="#" onclick="details();" title="Detalhes"><i class="fa fa-list" style="font-size:18px;color:green;padding:5px;"></i>Detalhes</a>
			<a href="#" onclick="edit();" title="Editar"><i class="fa fa-edit" style="font-size:18px;color:green;padding:5px;"></i>Editar</a>
			<a href="#" title="Excluir" onclick="confirmDelete();"><i class="fa fa-trash-o" style="font-size:18px;color:green;padding:5px;"></i>Excluir</a>
		</div>
		<br/>
		<div>
			Processo: 
			<select class="easyui-combobox" panelHeight="auto" style="width:200px">
				<option value=""></option>
				<option value="urgente">Ordem de Servico</option>
				<option value="alta">Ordem de Compra</option>
				<option value="media">Aviso de Ferias</option>
				<option value="baixa">Contratacao de Funcionario</option>
			</select>

			Data Criação: <input class="easyui-datebox" style="width:80px">
			Até: <input class="easyui-datebox" style="width:80px">
			
			Prioridade: 
			<select class="easyui-combobox" panelHeight="auto" style="width:100px">
				<option value=""></option>
				<option value="urgente">Urgente</option>
				<option value="alta">Alta</option>
				<option value="media">Média</option>
				<option value="baixa">Baixa</option>
			</select>
			<a href="#" class="easyui-linkbutton" iconCls="icon-search">Pesquisar</a>
		</div>
	</div>
    </div>

	<input type="hidden" id="selectedItemId"/>
	
	<script>
		function search(){
		}
		function onClickRow(index){
			var row = $('#dg').datagrid('getSelected');
			if (row){
				$('#selectedItemId').val(row.id);
			}
		}
		function confirmDelete(){
			$.messager.confirm('Aviso', 'Confirma exclusão?', function(r){
				if (r){
					//alert('confirmed: '+r);
				}
			});
		}

		function details(){
			var id = $('#selectedItemId').val();
			if ("0001" == id){
				window.location.href = 'file:///D:/workspace-grima/prototipo/scheduleExecution.html';				
			} else if ("0002" == id){
				window.location.href = 'file:///D:/workspace-grima/prototipo/approveSchedule.html';				
			} else if ("0003" == id){
				window.location.href = 'file:///D:/workspace-grima/prototipo/sendItems.html';				
			} else if ("0004" == id){
				window.location.href = 'file:///D:/workspace-grima/prototipo/receiveItems.html';				
			} else if ("0005" == id){
				window.location.href = 'file:///D:/workspace-grima/prototipo/takePictures.html';				
			} else if ("0006" == id){
				window.location.href = 'file:///D:/workspace-grima/prototipo/handlePictures.html';				
			} else if ("0007" == id){
				window.location.href = 'file:///D:/workspace-grima/prototipo/diagramTags.html';
			} else if ("0008" == id){
				window.location.href = 'file:///D:/workspace-grima/prototipo/finishOrder.html';				
			}
		}

		function edit(){
			details();
		}		
		
	</script>
	
	<script>
		$('#header').load('header.html');
		$('#footer').load('footer.html');
		$('#menu').load('menu.html');
	</script>

</body>
</html>